package com.example.feign.clients;

import com.example.common.Entity.User;
import com.example.common.response.R;
import com.example.feign.clients.fallback.UserClientCallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 发送http请求给用户管理中心服务的接口类
 *
 * @author Liaorun
 */
@FeignClient(value = "usercenter", fallbackFactory = UserClientCallbackFactory.class)
public interface UserClient {

    /**
     * 获取用户
     *
     * @param id 用户id
     * @return 用户对象
     */
    @GetMapping("/user/{id}")
    R<User> findById(@PathVariable("id") Long id);
}
